/**
 * @author antonio081014
 * @since Dec 17, 2011, 9:02:35 AM
 */

public class P8XMatrixTransformation {
	public String solve(String[] original, String[] target) {
		return counter(original) == counter(target) ? "YES" : "NO";
	}

	public int counter(String[] matrix) {
		int ret = 0;
		for (int i = 0; i < matrix.length; i++) {
			for (int j = 0; j < matrix[i].length(); j++) {
				if (matrix[i].charAt(j) == '1')
					ret++;
			}
		}
		return ret;
	}

	// <%:testing-code%>
}
// Powered by [KawigiEdit] 2.0!
